package com.String;

public class StringDemo1 {
    public static void main(String[] args) {
        //熟悉字符常用方法
        String s="吴智海408";
        //1.字符串的长度；
        System.out.println(s.length());

        //2.提取字符串中某个索引位置处的字符串
        for (int i = 0; i < s.length(); i++) {
            System.out.print(s.charAt(i));
        }System.out.println();

        //3.把字符串变成字符数组
        char[] a=s.toCharArray();
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
        }System.out.println();

        //4.判断字符串内容，内容一样就返回true
        String s1="吴智海409";
        String s2="吴智海409";
        System.out.println(s1.equals(s2));

        //5.忽略大小写比较字符串
        String s3="Abc";
        String s4="abc";
        System.out.println(s3.equals(s4));
        System.out.println(s3.equalsIgnoreCase(s4));

        //6.截取字符串
        String c="你是一个大傻逼";
        System.out.println(c.substring(0,5));

        //7.从当前索引位置一直截取道字符串的末尾
        System.out.println(c.substring(5));

        //8.把字符串的某个内容替换成新的内容，并返回新的字符串对象
        String c1=c.replace("傻逼","**");
        System.out.println(c1);

        //9.判断字符串中是否包含某个关键字
        System.out.println(c.contains("傻逼"));

        //10.判断字符串是否以某个字符串开头
        System.out.println(c.startsWith("你"));

        //11.把字符串按照某个指定内容分割成多个字符串，放到一个字符串数组中返回给我们
        String d="吴智海,吴雨欣,吴本金";
        String[] name=d.split(",");
        for (int i = 0; i < name.length; i++) {
            System.out.println(name[i]);
        }

    }


}
